package com.example.shirodemo.controller;

import com.example.shirodemo.constant.HttpCode;
import com.example.shirodemo.dto.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 绫小路
 * @date 2021/1/11 23:16
 * @description
 */
@Api(tags = "99-错误页面，如404等：ErrorController")
@Controller
public class ErrorController {

  @ApiOperation("404未找到页面")
  @GetMapping("/404")
  public String e404() {
    return "error/404";
  }

  @ApiOperation("401未授权页面")
  @GetMapping("/401")
  @ResponseBody
  public ResponseResult e401(){
    return new ResponseResult(HttpCode.FAIL,"未授权的资源 401");
  }
}
